import { request } from "../utils/request";

export function getUserInfoAPI() {
    return request({
        url: '/user',
        method: 'GET',
    })
}

export function loginAPI(data) {
    return request({
        url: '/user/login',
        method: 'POST',
        data
    })
}

export function getHousesAPI() {
    return request({
        url: '/user/houses',
        method: 'GET',
    })
}

export function addHousesAPI(data) {
    return request({
        url: '/user/houses',
        method: 'POST',
        data
    })
}

export function getHousesParamsAPI() {
    return request({
        url: '/houses/params',
        method: 'GET',
    })
}

export function getHousesCommunityAPI(name,id) {
    return request({
        url: '/area/community',
        method: 'GET',
        params: {
            name,
            id,
        }
    })
}
export function getFavoritesHousesAPI() {
    return request({
        url: '/user/favorites',
        method: 'GET',
    })
}
export function getFavoritesAPI(id) {
    return request({
        url: `/user/favorites/${id}`,
        method: 'GET',
    })
}
export function addFavoritesAPI(id) {
    return request({
        url: `/user/favorites/${id}`,
        method: 'POST',
    })
}
export function delFavoritesAPI(id) {
    return request({
        url: `/user/favorites/${id}`,
        method: 'DELETE',
    })
}